package com.yxy.mapper;

import com.yxy.domain.po.Sign;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface SignMapper {

    /**
     * 根据用户id和当前时间获取签到信息
     * @param id
     * @param date
     * @return
     */
    @Select("select * from sign where user_id = #{id} and sign_date = #{date}")
    Sign getSignByUserIdAndCurrentDate(Integer id, LocalDate date);

    /**
     * 添加签到信息
     * @param sign
     */
    void add(Sign sign);

    /**
     * 根据用户id获取签到信息
     * @param id
     * @return
     */
    @Select("select * from sign where user_id = #{id} and status = 1")
    List<Sign> selectByUserId(Integer id);

    /**
     * 根据用户id批量删除签到信息
     * @param ids
     */
    void deleteByUserIds(List<Integer> ids);
}
